package com.privatetime.dao.impl;

import java.util.List;

import com.privatetime.dao.GroupDao;
import com.privatetime.model.Group;

public class GroupDaoImpl extends BaseDaoImpl<Group, Integer> implements
		GroupDao {

	private static final String FLAG = "checkbox";

	public List<Group> findGroupList(Integer userId) {
		StringBuffer sql = new StringBuffer();
		sql
				.append("from Group group join group.userSet users where users.id=?");
		List<Group> list = this.findEntityList(sql.toString(), userId);
		return list;
	}

	public List<Group> findGroupList(List<Integer> checkboxList) {
		StringBuffer sql = new StringBuffer();
		sql.append("from Group group where group.id in (:").append(FLAG)
				.append(")");
		List<Group> list = this.findEntityList(sql.toString(), FLAG,
				checkboxList);
		return list;
	}

}
